﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using JobSiteStarterKit.DAL;
namespace JobSiteStarterKit.BOL
{
    /// <summary>
    /// Summary description for Industry
    /// </summary>
    public class Industry
    {   
        private int IndustryId;
        private string SIndustryName;
        public Industry()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public int IndustryID
        {
            get
            {
                return IndustryId;
            }
            set
            {
                IndustryId = value;
            }
        }

        public string IndustryName
        {
            get
            {
                return SIndustryName;
            }
            set
            {
                SIndustryName = value;
            }
        }
        public static DataSet fillindustry()
        {
            DBAccess db = new DBAccess();
            DataSet dsetindustry=new DataSet();
            dsetindustry =db.ExecuteDataSet("JobsDb_Industry_SelectAll");
            return dsetindustry;
        }
        public static DataSet fillfuntionalArea()
        {
            DBAccess db = new DBAccess();

            return db.ExecuteDataSet("JobsDb_FuntionalArea_SelectAll");
             
        }
        public int InsertIndustry(Industry obj)
        {
            DBAccess db = new DBAccess();
            SqlParameter p = new SqlParameter("@iIndustryID", 0);
            p.Direction = ParameterDirection.Output;
            db.AddParameter("@sIndustryName", obj.IndustryName);
            db.AddParameter(p);
            return db.ExecuteNonQuery("JobsDb_Industries_Insert");

        }

        public int UpdateIndustry(Industry obj)
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iIndustryID", obj.IndustryID);
            db.AddParameter("@sIndustryName", obj.IndustryName);
            return db.ExecuteNonQuery("JobsDb_Countries_Update");
        }
        public int Deleteindustry(int industryid)
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iIndustryID", IndustryID);
            return db.ExecuteNonQuery("JobsDb_Industries_Delete");
        }

        public static DataSet SelectIndustry()
        {
            DBAccess db = new DBAccess();
            return db.ExecuteDataSet("JobsDb_Industries_SelectAll");
        }

        public static string GetIndustryName(int industryid)
        {
            DBAccess db = new DBAccess();
            db.AddParameter("@iIndustryID", industryid);
            return db.ExecuteScalar("JobsDb_Countries_GetCountryName").ToString();
        }

        public static DataSet GetIndustry()
        {
            DBAccess db = new DBAccess();
            DataSet dsetindustry = new DataSet();
            dsetindustry = db.ExecuteDataSet("JobsDb_Industries_SelectAll");
            return dsetindustry;
        }

        
    }

}